<?php
use app\assets\CommissionAsset;
use yii\helpers\Html;

CommissionAsset::register($this);

?>



<div class="col-md-4 col-sm-6">
    <form class="form-horizontal " id="shopForm">
        <fieldset>
            <div id="legend" class="">
                <legend class="">店铺设置</legend>
            </div>
            <div class="form-group col-md-12 ">

                <!-- Text input-->
                <label class="control-label" for="input01">设置店名</label>
                <div class="controls">
                    <input type="text" placeholder="店铺名称" class="form-control" id="input01" value=<?= Html::encode($model->value) ?> check-type="required">
                </div>
            </div>

            <div class="form-group col-md-12">
                <div class="controls">
                    <p class="btn btn-primary">确认修改</p>
                </div>
            </div>

        </fieldset>
    </form>
</div>

<script>

    $("#shopForm").validation({icon: true, reqmark: false});

    $(function() {

        //正则

        $('.btn-primary').click(function(){

            //正则提示写法
            if ($("#shopForm").valid()==false){
                alert('填写信息有误,请检查');
                return false;
            }

            $.ajax({
                url: "update-shop-name",
                data:{'shop_name':$('#input01').val()},
                dataType: "json",
                success: function (data) {

                    console.log('data--->'+data);
                    alert('修改成功！');

                }
            });


        });

    });

</script>
